/* Copyright (c) 2016-2020 Enfry Ltd. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of Enfry. 
 * You shall not disclose such Confidential Information
 * and shall use it only in accordance with the terms of the agreements
 * you entered into with Enfry.
 */
package com.enfry.common.util.control;

/**
 * 
 * <请简单说明此类用途>
 * 
 * @Title com.enfry.util.control.Eventee
 * @author Penghu
 * @date 2018年1月10日
 */
public class Handlee implements Runnable {
	private Object req;
	private Handler handler;

	public Handlee(Object req, Handler handler) {
		this.req = req;
		this.handler = handler;
	}

	public void run() {
		handler.process(req);
	}

	public Object getObj() {
		return req;
	}

	public Handler getHandler() {
		return handler;
	}

	public int hasCode() {
		return req.hashCode();
	}

	public boolean equals(Object obj) {
		if (obj == null)
			return false;

		if (!(obj instanceof Handlee))
			return false;

		Handlee other = (Handlee) obj;
		if (other.req == null)
			return this.req == null;
		else
			return (other.req.equals(this.req));
	}

	public String toString() {
		return req.toString();
	}
}
